package com.dqyt.app.service;

import com.dqyt.app.bean.GzlqrdDelBean;
import com.dqyt.app.bean.Maintenance;
import com.dqyt.app.bean.Report;
import com.dqyt.app.bean.WorkBean;
import com.dqyt.app.mongo.MaintenanceDao;
import com.dqyt.app.mongo.ReportDao;
import com.dqyt.khjc.bean.ResultMsg;
import com.dqyt.khjc.mapper.WorkMapper;
import com.google.gson.internal.$Gson$Preconditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

@Service
public class AppGzlqrdDetalService {

    @Autowired
    private WorkMapper workMapper;
    @Autowired
    private ReportDao reportDao;

    @Autowired
    private MaintenanceDao maintenanceDao;


    public ResultMsg getgzltjdDetal(HttpServletRequest request, long userId, String token, String rwdbh){
        ResultMsg ret = new ResultMsg(); // 声明一个返回值
        try {
            //根据条件号查询 work表
            List<WorkBean> mw =  workMapper.getWorkStatistics(rwdbh,-1,-1,0,0,0);

            //把所有的标识编号都取出来
            List<String> bsbhList =  new ArrayList<>();
            for(WorkBean workBean :mw){
                bsbhList.add(workBean.getBsbh());
            }




            //然后查询已完成的报告 面罩的个数统计
            List<Report> mzNumbers = reportDao.getReportByBatch(bsbhList,1);
            int numberMzJm=0;
            for(Report report:mzNumbers){
                //除去维修替换了 背板/减压器
                boolean isbh =  report.bsbh.contains("_old");
                if(!isbh){
                    numberMzJm++;
                }
            }

            //根据 任务单编号和类型查询 已完成的报告 气瓶的个数统计
            List<Report> qpNumbers = reportDao.getReportByBatch(bsbhList,2);
            int numberQpJm=0;
            for(Report report2:qpNumbers){
                //除去维修替换了 背板/减压器
                boolean isbh =  report2.bsbh.contains("_old");
                if(!isbh){
                    numberQpJm++;
                }
            }

            //统计充气的气瓶有多少个
            List<Report> msamples=  reportDao.getReportByrwdbhOrCqBath(bsbhList);
            int numberQpCqJm =0;
            //维修
            for(Report mReport:msamples){
                //除去维修替换了 背板/减压器
                boolean isbh =  mReport.bsbh.contains("_old");
                if(!isbh){
                    numberQpCqJm++;
                }
            }
            //查询维修个数
            List<Maintenance>  maintenances=  maintenanceDao.getMaintenanceByRwdbhBath(bsbhList);
            HashSet<String> bjmcSet = new  HashSet<String>();
            for(Maintenance maiobj:maintenances){

                if(!"".equals(maiobj.mzGhbjpp)){
                    if(bjmcSet.size()<8){
                        bjmcSet.add(maiobj.mzGhbjpp);
                    }
                }
                if(!"".equals(maiobj.gqfGhbjpp)){
                    if(bjmcSet.size()<8) {
                        bjmcSet.add(maiobj.gqfGhbjpp);
                    }
                }
                if(!"".equals(maiobj.bjqGhbjpp)){
                    if(bjmcSet.size()<8) {
                        bjmcSet.add(maiobj.bjqGhbjpp);
                    }
                }
                if(!"".equals(maiobj.ylbGhbjpp)){
                    if(bjmcSet.size()<8) {
                        bjmcSet.add(maiobj.ylbGhbjpp);
                    }
                }
                if(!"".equals(maiobj.jyqGhbjpp)){
                    if(bjmcSet.size()<8) {
                        bjmcSet.add(maiobj.jyqGhbjpp);
                    }
                }
                if(!"".equals(maiobj.bbGhbjpp)){
                    if(bjmcSet.size()<8) {
                        bjmcSet.add(maiobj.bbGhbjpp);
                    }
                }
                if(!"".equals(maiobj.pfGhbjpp)){
                    if(bjmcSet.size()<8) {
                        bjmcSet.add(maiobj.pfGhbjpp);
                    }
                }
                if(!"".equals(maiobj.qpGhbjpp)){
                    if(bjmcSet.size()<8) {
                        bjmcSet.add(maiobj.qpGhbjpp);
                    }
                }
                if(!"".equals(maiobj.xzGhbjpp)){
                    if(bjmcSet.size()<8) {
                        bjmcSet.add(maiobj.xzGhbjpp);
                    }
                }
            }
            //名牌名称
            String t_mc1 = "";
            String t_mc2 = "";
            String t_mc3 = "";
            String t_mc4 = "";
            String t_mc5 = "";
            String t_mc6 = "";
            String t_mc7 = "";
            String t_mc8 = "";

            //第一行
            int t_mz1=0;
            int t_mz2=0;
            int t_mz3=0;
            int t_mz4=0;
            int t_mz5=0;
            int t_mz6=0;
            int t_mz7=0;
            int t_mz8=0;
            String t_str_mc1 = "";
            String t_str_mc2 = "";
            String t_str_mc3 = "";
            String t_str_mc4 = "";
            String t_str_mc5 = "";
            String t_str_mc6 = "";
            String t_str_mc7 = "";
            String t_str_mc8 = "";

            //第二行
            int t_gqf1=0;
            int t_gqf2=0;
            int t_gqf3=0;
            int t_gqf4=0;
            int t_gqf5=0;
            int t_gqf6=0;
            int t_gqf7=0;
            int t_gqf8=0;
            String t_str_gqf1 = "";
            String t_str_gqf2 = "";
            String t_str_gqf3 = "";
            String t_str_gqf4 = "";
            String t_str_gqf5 = "";
            String t_str_gqf6 = "";
            String t_str_gqf7 = "";
            String t_str_gqf8 = "";

            //第三行
            int t_bjq1=0;
            int t_bjq2=0;
            int t_bjq3=0;
            int t_bjq4=0;
            int t_bjq5=0;
            int t_bjq6=0;
            int t_bjq7=0;
            int t_bjq8=0;
            String t_str_bjq1 = "";
            String t_str_bjq2 = "";
            String t_str_bjq3 = "";
            String t_str_bjq4 = "";
            String t_str_bjq5 = "";
            String t_str_bjq6 = "";
            String t_str_bjq7 = "";
            String t_str_bjq8 = "";

            //第四行
            int t_ylb1=0;
            int t_ylb2=0;
            int t_ylb3=0;
            int t_ylb4=0;
            int t_ylb5=0;
            int t_ylb6=0;
            int t_ylb7=0;
            int t_ylb8=0;
            String t_str_ylb1 = "";
            String t_str_ylb2 = "";
            String t_str_ylb3 = "";
            String t_str_ylb4 = "";
            String t_str_ylb5 = "";
            String t_str_ylb6 = "";
            String t_str_ylb7 = "";
            String t_str_ylb8 = "";



            //第五行
            //减压器的
            int t_jyq1 = 0;
            int t_jyq2 = 0;
            int t_jyq3 = 0;
            int t_jyq4 = 0;
            int t_jyq5 = 0;
            int t_jyq6 = 0;
            int t_jyq7 = 0;
            int t_jyq8 = 0;
            //背板的
            int t_bb1 = 0;
            int t_bb2 = 0;
            int t_bb3 = 0;
            int t_bb4 = 0;
            int t_bb5 = 0;
            int t_bb6 = 0;
            int t_bb7 = 0;
            int t_bb8 = 0;
            String t_str_jyqOrBb1 = "";
            String t_str_jyqOrBb2 = "";
            String t_str_jyqOrBb3 = "";
            String t_str_jyqOrBb4 = "";
            String t_str_jyqOrBb5 = "";
            String t_str_jyqOrBb6 = "";
            String t_str_jyqOrBb7 = "";
            String t_str_jyqOrBb8 = "";


            //第六行
            int t_pf1 = 0;
            int t_pf2 = 0;
            int t_pf3 = 0;
            int t_pf4 = 0;
            int t_pf5 = 0;
            int t_pf6 = 0;
            int t_pf7 = 0;
            int t_pf8 = 0;
            String t_str_pf1 = "";
            String t_str_pf2 = "";
            String t_str_pf3 = "";
            String t_str_pf4 = "";
            String t_str_pf5 = "";
            String t_str_pf6 = "";
            String t_str_pf7 = "";
            String t_str_pf8 = "";

            //第7行
            String t_str_qp1 = "";
            String t_str_qp2 = "";
            String t_str_qp3 = "";
            String t_str_qp4 = "";
            String t_str_qp5 = "";
            String t_str_qp6 = "";
            String t_str_qp7 = "";
            String t_str_qp8 = "";
            int t_qp1 = 0;
            int t_qp2 = 0;
            int t_qp3 = 0;
            int t_qp4 = 0;
            int t_qp5 = 0;
            int t_qp6 = 0;
            int t_qp7 = 0;
            int t_qp8 = 0;

            //第八行
            int t_xz1 = 0;
            int t_xz2 = 0;
            int t_xz3 = 0;
            int t_xz4 = 0;
            int t_xz5 = 0;
            int t_xz6 = 0;
            int t_xz7 = 0;
            int t_xz8 = 0;
            String t_str_xz1 = "";
            String t_str_xz2 = "";
            String t_str_xz3 = "";
            String t_str_xz4 = "";
            String t_str_xz5 = "";
            String t_str_xz6 = "";
            String t_str_xz7 = "";
            String t_str_xz8 = "";

            //总数
            String t_totle1 = "";
            String t_totle2 = "";
            String t_totle3 = "";
            String t_totle4 = "";
            String t_totle5 = "";
            String t_totle6 = "";
            String t_totle7 = "";
            String t_totle8 = "";

            //把set转list
            List<String> setList = new ArrayList<String>(bjmcSet);
            //把品牌都设置到部件名称框里面
            for(int k=0;k<setList.size();k++){
                switch(k) {
                    case 0:
                        t_mc1 = setList.get(k);
                        break;
                    case 1:
                        t_mc2 = setList.get(k);
                        break;
                    case 2:
                        t_mc3 = setList.get(k);
                        break;
                    case 3:
                        t_mc4 = setList.get(k);
                        break;
                    case 4:
                        t_mc5 = setList.get(k);
                        break;
                    case 5:
                        t_mc6 = setList.get(k);
                        break;
                    case 6:
                        t_mc7 = setList.get(k);
                        break;
                    case 7:
                        t_mc8 = setList.get(k);
                        break;
                }
            }

            for(int c=0;c<maintenances.size();c++){
                Maintenance  mobj = maintenances.get(c);
                //第一行--------------------------------------------------------------------------------------
                if(mobj.mzGhbjpp.equals(t_mc1)  && !"".equals(t_mc1)){
                    t_mz1 = t_mz1+1;
                }
                if(mobj.mzGhbjpp.equals(t_mc2)  && !"".equals(t_mc2)){
                    t_mz2 = t_mz2+1;
                }
                if(mobj.mzGhbjpp.equals(t_mc3)  && !"".equals(t_mc3)){
                    t_mz3 = t_mz3+1;
                }
                if(mobj.mzGhbjpp.equals(t_mc4)  && !"".equals(t_mc4)){
                    t_mz4 = t_mz4+1;
                }
                if(mobj.mzGhbjpp.equals(t_mc5)  && !"".equals(t_mc5)){
                    t_mz5 = t_mz5+1;
                }
                if(mobj.mzGhbjpp.equals(t_mc6)  && !"".equals(t_mc6)){
                    t_mz6 = t_mz6+1;
                }
                if(mobj.mzGhbjpp.equals(t_mc7)  && !"".equals(t_mc7)){
                    t_mz7 = t_mz7+1;
                }
                if(mobj.mzGhbjpp.equals(t_mc8)  && !"".equals(t_mc8)){
                    t_mz8 = t_mz8+1;
                }


                //第二行--------------------------------------------------------------------------------------
                if(mobj.gqfGhbjpp.equals(t_mc1) && !t_mc1.equals("")){
                    t_gqf1 =t_gqf1+1;
                }
                if(mobj.gqfGhbjpp.equals(t_mc2) && !t_mc2.equals("")){
                    t_gqf2 =t_gqf2+1;
                }
                if(mobj.gqfGhbjpp.equals(t_mc3) && !t_mc3.equals("")){
                    t_gqf3 =t_gqf3+1;
                }
                if(mobj.gqfGhbjpp.equals(t_mc4) && !t_mc4.equals("")){
                    t_gqf4 =t_gqf4+1;
                }
                if(mobj.gqfGhbjpp.equals(t_mc5) && !t_mc5.equals("")){
                    t_gqf5 =t_gqf5+1;
                }
                if(mobj.gqfGhbjpp.equals(t_mc6) && !t_mc6.equals("")){
                    t_gqf6 =t_gqf6+1;
                }
                if(mobj.gqfGhbjpp.equals(t_mc7) && !t_mc7.equals("")){
                    t_gqf7 =t_gqf7+1;
                }
                if(mobj.gqfGhbjpp.equals(t_mc8) && !t_mc8.equals("")){
                    t_gqf8 =t_gqf8+1;
                }

                //第三行--------------------------------------------------------------------------------------
                if(mobj.bjqGhbjpp.equals(t_mc1) && !t_mc1.equals("")){
                    t_bjq1 = t_bjq1+1;
                }
                if(mobj.bjqGhbjpp.equals(t_mc2) && !t_mc2.equals("")){
                    t_bjq2 = t_bjq2+1;
                }
                if(mobj.bjqGhbjpp.equals(t_mc3) && !t_mc3.equals("")){
                    t_bjq3 = t_bjq3+1;
                }
                if(mobj.bjqGhbjpp.equals(t_mc4) && !t_mc4.equals("")){
                    t_bjq4 = t_bjq4+1;
                }
                if(mobj.bjqGhbjpp.equals(t_mc5) && !t_mc5.equals("")){
                    t_bjq5 = t_bjq5+1;
                }
                if(mobj.bjqGhbjpp.equals(t_mc6) && !t_mc6.equals("")){
                    t_bjq6 = t_bjq6+1;
                }
                if(mobj.bjqGhbjpp.equals(t_mc7) && !t_mc7.equals("")){
                    t_bjq7 = t_bjq7+1;
                }
                if(mobj.bjqGhbjpp.equals(t_mc8) && !t_mc8.equals("")){
                    t_bjq8 = t_bjq8+1;
                }


                //第四行--------------------------------------------------------------------------------------
                if(mobj.ylbGhbjpp.equals(t_mc1) && !t_mc1.equals("")){
                    t_ylb1 = t_ylb1+1;
                }
                if(mobj.ylbGhbjpp.equals(t_mc2) && !t_mc2.equals("")){
                    t_ylb2 = t_ylb2+1;
                }
                if(mobj.ylbGhbjpp.equals(t_mc3) && !t_mc3.equals("")){
                    t_ylb3 = t_ylb3+1;
                }
                if(mobj.ylbGhbjpp.equals(t_mc4) && !t_mc4.equals("")){
                    t_ylb4 = t_ylb4+1;
                }
                if(mobj.ylbGhbjpp.equals(t_mc5) && !t_mc5.equals("")){
                    t_ylb5 = t_ylb5+1;
                }
                if(mobj.ylbGhbjpp.equals(t_mc6) && !t_mc6.equals("")){
                    t_ylb6 = t_ylb6+1;
                }
                if(mobj.ylbGhbjpp.equals(t_mc7) && !t_mc7.equals("")){
                    t_ylb7 = t_ylb7+1;
                }
                if(mobj.ylbGhbjpp.equals(t_mc8) && !t_mc8.equals("")){
                    t_ylb8 = t_ylb8+1;
                }


                //第五行--------------------------------------------------------------------------------------
                //减压器
                if(mobj.jyqGhbjpp.equals(t_mc1) && !t_mc1.equals("")){
                    t_jyq1 = t_jyq1+1;
                }
                if(mobj.jyqGhbjpp.equals(t_mc2) && !t_mc2.equals("")){
                    t_jyq2 = t_jyq2+1;
                }
                if(mobj.jyqGhbjpp.equals(t_mc3) && !t_mc3.equals("")){
                    t_jyq3 = t_jyq3+1;
                }
                if(mobj.jyqGhbjpp.equals(t_mc4) && !t_mc4.equals("")){
                    t_jyq4 = t_jyq4+1;
                }
                if(mobj.jyqGhbjpp.equals(t_mc5) && !t_mc5.equals("")){
                    t_jyq5 = t_jyq5+1;
                }
                if(mobj.jyqGhbjpp.equals(t_mc6) && !t_mc6.equals("")){
                    t_jyq6 = t_jyq6+1;
                }
                if(mobj.jyqGhbjpp.equals(t_mc7) && !t_mc7.equals("")){
                    t_jyq7 = t_jyq7+1;
                }
                if(mobj.jyqGhbjpp.equals(t_mc8) && !t_mc8.equals("")){
                    t_jyq8 = t_jyq8+1;
                }
                //背板
                if(mobj.bbGhbjpp.equals(t_mc1) && !t_mc1.equals("")){
                    t_bb1 = t_bb1+1;
                }
                if(mobj.bbGhbjpp.equals(t_mc2) && !t_mc2.equals("")){
                    t_bb2 = t_bb2+1;
                }
                if(mobj.bbGhbjpp.equals(t_mc3) && !t_mc3.equals("")){
                    t_bb3 = t_bb3+1;
                }
                if(mobj.bbGhbjpp.equals(t_mc4) && !t_mc4.equals("")){
                    t_bb4 = t_bb4+1;
                }
                if(mobj.bbGhbjpp.equals(t_mc5) && !t_mc5.equals("")){
                    t_bb5 = t_bb5+1;
                }
                if(mobj.bbGhbjpp.equals(t_mc6) && !t_mc6.equals("")){
                    t_bb6 = t_bb6+1;
                }
                if(mobj.bbGhbjpp.equals(t_mc7) && !t_mc7.equals("")){
                    t_bb7 = t_bb7+1;
                }
                if(mobj.bbGhbjpp.equals(t_mc8) && !t_mc8.equals("")){
                    t_bb8 = t_bb8+1;
                }


                //第六行--------------------------------------------------------------------------------------
                if(mobj.pfGhbjpp.equals(t_mc1) && !t_mc1.equals("")){
                    t_pf1 = t_pf1+1;
                }
                if(mobj.pfGhbjpp.equals(t_mc2) && !t_mc2.equals("")){
                    t_pf2 = t_pf2+1;
                }
                if(mobj.pfGhbjpp.equals(t_mc3) && !t_mc3.equals("")){
                    t_pf3 = t_pf3+1;
                }
                if(mobj.pfGhbjpp.equals(t_mc4) && !t_mc4.equals("")){
                    t_pf4 = t_pf4+1;
                }
                if(mobj.pfGhbjpp.equals(t_mc5) && !t_mc5.equals("")){
                    t_pf5 = t_pf5+1;
                }
                if(mobj.pfGhbjpp.equals(t_mc6) && !t_mc6.equals("")){
                    t_pf6 = t_pf6+1;
                }
                if(mobj.pfGhbjpp.equals(t_mc7) && !t_mc7.equals("")){
                    t_pf7 = t_pf7+1;
                }
                if(mobj.pfGhbjpp.equals(t_mc8) && !t_mc8.equals("")){
                    t_pf8 = t_pf8+1;
                }

                //第七行--------------------------------------------------------------------------------------
                if(mobj.qpGhbjpp.equals(t_mc1) && !t_mc1.equals("")){
                    t_qp1 = t_qp1+1;
                }
                if(mobj.qpGhbjpp.equals(t_mc2) && !t_mc2.equals("")){
                    t_qp2 = t_qp2+1;
                }
                if(mobj.qpGhbjpp.equals(t_mc3) && !t_mc3.equals("")){
                    t_qp3 = t_qp3+1;
                }
                if(mobj.qpGhbjpp.equals(t_mc4) && !t_mc4.equals("")){
                    t_qp4 = t_qp4+1;
                }
                if(mobj.qpGhbjpp.equals(t_mc5) && !t_mc5.equals("")){
                    t_qp5 = t_qp5+1;
                }
                if(mobj.qpGhbjpp.equals(t_mc6) && !t_mc6.equals("")){
                    t_qp6 = t_qp6+1;
                }
                if(mobj.qpGhbjpp.equals(t_mc7) && !t_mc7.equals("")){
                    t_qp7 = t_qp7+1;
                }
                if(mobj.qpGhbjpp.equals(t_mc8) && !t_mc8.equals("")){
                    t_qp8 = t_qp8+1;
                }


                //第八行--------------------------------------------------------------------------------------
                if(mobj.xzGhbjpp.equals(t_mc1) && !t_mc1.equals("")){
                    t_xz1 = t_xz1+1;
                }
                if(mobj.xzGhbjpp.equals(t_mc2) && !t_mc2.equals("")){
                    t_xz2 = t_xz2+1;
                }
                if(mobj.xzGhbjpp.equals(t_mc3) && !t_mc3.equals("")){
                    t_xz3 = t_xz3+1;
                }
                if(mobj.xzGhbjpp.equals(t_mc4) && !t_mc4.equals("")){
                    t_xz4 = t_xz4+1;
                }
                if(mobj.xzGhbjpp.equals(t_mc5) && !t_mc5.equals("")){
                    t_xz5 = t_xz5+1;
                }
                if(mobj.xzGhbjpp.equals(t_mc6) && !t_mc6.equals("")){
                    t_xz6 = t_xz6+1;
                }
                if(mobj.xzGhbjpp.equals(t_mc7) && !t_mc7.equals("")){
                    t_xz7 = t_xz7+1;
                }
                if(mobj.xzGhbjpp.equals(t_mc8) && !t_mc8.equals("")){
                    t_xz8 = t_xz8+1;
                }
            }



            //第一行的值---------------------------------------------------------------------------------------------
            if(t_mz1 != 0){
                t_str_mc1 =t_mz1+"";
            }
            if(t_mz2 != 0){
                t_str_mc2 =t_mz2+"";
            }
            if(t_mz3 != 0){
                t_str_mc3 =t_mz3+"";
            }
            if(t_mz4 != 0){
                t_str_mc4 =t_mz4+"";
            }
            if(t_mz5 != 0){
                t_str_mc5 =t_mz5+"";
            }
            if(t_mz6 != 0){
                t_str_mc6 =t_mz6+"";
            }
            if(t_mz7 != 0){
                t_str_mc7 =t_mz7+"";
            }
            if(t_mz8 != 0){
                t_str_mc8 =t_mz8+"";
            }


            //第二行的值---------------------------------------------------------------------------------------------
            if(t_gqf1 != 0){
                t_str_gqf1 =t_gqf1+"";
            }
            if(t_gqf2 != 0){
                t_str_gqf2 =t_gqf2+"";
            }
            if(t_gqf3 != 0){
                t_str_gqf3 =t_gqf3+"";
            }
            if(t_gqf4 != 0){
                t_str_gqf4 =t_gqf4+"";
            }
            if(t_gqf5 != 0){
                t_str_gqf5 =t_gqf5+"";
            }
            if(t_gqf6 != 0){
                t_str_gqf6 =t_gqf6+"";
            }
            if(t_gqf7 != 0){
                t_str_gqf7 =t_gqf7+"";
            }
            if(t_gqf8 != 0){
                t_str_gqf8 =t_gqf8+"";
            }

            //第三行的值---------------------------------------------------------------------------------------------
            if(t_bjq1 != 0){
                t_str_bjq1 =t_bjq1+"";
            }
            if(t_bjq2 != 0){
                t_str_bjq2 =t_bjq2+"";
            }
            if(t_bjq3 != 0){
                t_str_bjq3 =t_bjq3+"";
            }
            if(t_bjq4 != 0){
                t_str_bjq4 =t_bjq4+"";
            }
            if(t_bjq5 != 0){
                t_str_bjq5 =t_bjq5+"";
            }
            if(t_bjq6 != 0){
                t_str_bjq6 =t_bjq6+"";
            }
            if(t_bjq7 != 0){
                t_str_bjq7 =t_bjq7+"";
            }
            if(t_bjq8 != 0){
                t_str_bjq8 =t_bjq8+"";
            }


            //第四行的值---------------------------------------------------------------------------------------------
            if(t_ylb1 != 0){
                t_str_ylb1 =t_ylb1+"";
            }
            if(t_ylb2 != 0){
                t_str_ylb2 =t_ylb2+"";
            }
            if(t_ylb3 != 0){
                t_str_ylb3 =t_ylb3+"";
            }
            if(t_ylb4 != 0){
                t_str_ylb4 =t_ylb4+"";
            }
            if(t_ylb5 != 0){
                t_str_ylb5 =t_ylb5+"";
            }
            if(t_ylb6 != 0){
                t_str_ylb6 =t_ylb6+"";
            }
            if(t_ylb7 != 0){
                t_str_ylb7 =t_ylb7+"";
            }
            if(t_ylb8 != 0){
                t_str_ylb8 =t_ylb8+"";
            }

            //第五行的值---------------------------------------------------------------------------------------------
            //将减压器和背板的数量加起来 才是背具总成
            int jyqOrBb1 = t_jyq1 + t_bb1;
            int jyqOrBb2 = t_jyq2 + t_bb2;
            int jyqOrBb3 = t_jyq3 + t_bb3;
            int jyqOrBb4 = t_jyq4 + t_bb4;
            int jyqOrBb5 = t_jyq5 + t_bb5;
            int jyqOrBb6 = t_jyq6 + t_bb6;
            int jyqOrBb7 = t_jyq7 + t_bb7;
            int jyqOrBb8 = t_jyq8 + t_bb8;


            //背板
            if(jyqOrBb1 != 0){
                t_str_jyqOrBb1 =jyqOrBb1+"";
            }
            if(jyqOrBb2 != 0){
                t_str_jyqOrBb2 =jyqOrBb2+"";
            }
            if(jyqOrBb3 != 0){
                t_str_jyqOrBb3 =jyqOrBb3+"";
            }
            if(jyqOrBb4 != 0){
                t_str_jyqOrBb4 =jyqOrBb4+"";
            }
            if(jyqOrBb5 != 0){
                t_str_jyqOrBb5 =jyqOrBb5+"";
            }
            if(jyqOrBb6 != 0){
                t_str_jyqOrBb6 =jyqOrBb6+"";
            }
            if(jyqOrBb7 != 0){
                t_str_jyqOrBb7 =jyqOrBb7+"";
            }
            if(jyqOrBb8 != 0){
                t_str_jyqOrBb8 =jyqOrBb8+"";
            }

            //第六行的值---------------------------------------------------------------------------------------------
            if(t_pf1 != 0){
                t_str_pf1 =t_pf1+"";
            }
            if(t_pf2 != 0){
                t_str_pf2 =t_pf2+"";
            }
            if(t_pf3 != 0){
                t_str_pf3 =t_pf3+"";
            }
            if(t_pf4 != 0){
                t_str_pf4 =t_pf4+"";
            }
            if(t_pf5 != 0){
                t_str_pf5 =t_pf5+"";
            }
            if(t_pf6 != 0){
                t_str_pf6 =t_pf6+"";
            }
            if(t_pf7 != 0){
                t_str_pf7 =t_pf7+"";
            }
            if(t_pf8 != 0){
                t_str_pf8 =t_pf8+"";
            }


            //第七行的值---------------------------------------------------------------------------------------------
            if(t_qp1 != 0){
                t_str_qp1 =t_qp1+"";
            }
            if(t_qp2 != 0){
                t_str_qp2 =t_qp2+"";
            }
            if(t_qp3 != 0){
                t_str_qp3 =t_qp3+"";
            }
            if(t_qp4 != 0){
                t_str_qp4 =t_qp4+"";
            }
            if(t_qp5 != 0){
                t_str_qp5 =t_qp5+"";
            }
            if(t_qp6 != 0){
                t_str_qp6 =t_qp6+"";
            }
            if(t_qp7 != 0){
                t_str_qp7 =t_qp7+"";
            }
            if(t_qp8 != 0){
                t_str_qp8 =t_qp8+"";
            }

            //第八行的值---------------------------------------------------------------------------------------------
            if(t_xz1 != 0){
                t_str_xz1 =t_xz1+"";
            }
            if(t_xz2 != 0){
                t_str_xz2 =t_xz2+"";
            }
            if(t_xz3 != 0){
                t_str_xz3 =t_xz3+"";
            }
            if(t_xz4 != 0){
                t_str_xz4 =t_xz4+"";
            }
            if(t_xz5 != 0){
                t_str_xz5 =t_xz5+"";
            }
            if(t_xz6 != 0){
                t_str_xz6 =t_xz6+"";
            }
            if(t_xz7 != 0){
                t_str_xz7 =t_xz7+"";
            }
            if(t_xz8 != 0){
                t_str_xz8 =t_xz8+"";
            }

            int totleNum1= t_mz1+t_mz2+t_mz3+t_mz4 +t_mz5+t_mz6+t_mz7+t_mz8;
            int totleNum2= t_gqf1+t_gqf2+t_gqf3+t_gqf4+t_gqf5+t_gqf6+t_gqf7+t_gqf8 ;
            int totleNum3= t_bjq1+t_bjq2+t_bjq3+t_bjq4+t_bjq5+t_bjq6+t_bjq7+t_bjq8;
            int totleNum4= t_ylb1+t_ylb2+t_ylb3+t_ylb4+t_ylb5+t_ylb6+t_ylb7+t_ylb8;
            int totleNum5=  jyqOrBb1+jyqOrBb2+jyqOrBb3+jyqOrBb4+jyqOrBb5+jyqOrBb6+jyqOrBb7+jyqOrBb8;
            int totleNum6= t_pf1+t_pf2+t_pf3+t_pf4+t_pf5+t_pf6+t_pf7+t_pf8;
            int totleNum7= t_qp1+t_qp2+t_qp3+t_qp4+t_qp5+t_qp6+t_qp7+t_qp8;
            int totleNum8= t_xz1 +t_xz2+t_xz3+t_xz4+t_xz5+t_xz6+t_xz7+t_xz8;

            if(totleNum1 != 0){
                t_totle1 = totleNum1+"";
            }
            if(totleNum2 != 0){
                t_totle2 = totleNum2+"";
            }
            if(totleNum3 != 0){
                t_totle3 = totleNum3+"";
            }
            if(totleNum4 != 0){
                t_totle4 = totleNum4+"";
            }
            if(totleNum5 != 0){
                t_totle5 = totleNum5+"";
            }
            if(totleNum6 != 0){
                t_totle6 = totleNum6+"";
            }
            if(totleNum7 != 0){
                t_totle7 = totleNum7+"";
            }
            if(totleNum8 != 0){
                t_totle8 = totleNum8+"";
            }

            GzlqrdDelBean gzlqrdDelBean =new GzlqrdDelBean();
            gzlqrdDelBean.setRwdbh(rwdbh);
            gzlqrdDelBean.setWtf("");
            if(0!=numberMzJm){
                gzlqrdDelBean.setMzjy(numberMzJm);
            }else{
                gzlqrdDelBean.setMzjy(0);
            }

            if(0!=numberQpJm){
                gzlqrdDelBean.setQpjy(numberQpJm);
            }else{
                gzlqrdDelBean.setQpjy(0);
            }

            if(0!=numberQpCqJm){
                gzlqrdDelBean.setCqnum(numberQpCqJm);
            }else{
                gzlqrdDelBean.setCqnum(0);
            }

            if(0!=maintenances.size()){
                gzlqrdDelBean.setWxnum(maintenances.size());
            }else{
                gzlqrdDelBean.setWxnum(0);
            }

            //品牌名称
            gzlqrdDelBean.setPp_name1(t_mc1);
            gzlqrdDelBean.setPp_name2(t_mc2);
            gzlqrdDelBean.setPp_name3(t_mc3);
            gzlqrdDelBean.setPp_name4(t_mc4);
            gzlqrdDelBean.setPp_name5(t_mc5);
            gzlqrdDelBean.setPp_name6(t_mc6);
            gzlqrdDelBean.setPp_name7(t_mc7);
            gzlqrdDelBean.setPp_name8(t_mc8);

            //面罩
            gzlqrdDelBean.setMz_pp_num1(t_str_mc1);
            gzlqrdDelBean.setMz_pp_num2(t_str_mc2);
            gzlqrdDelBean.setMz_pp_num3(t_str_mc3);
            gzlqrdDelBean.setMz_pp_num4(t_str_mc4);
            gzlqrdDelBean.setMz_pp_num5(t_str_mc5);
            gzlqrdDelBean.setMz_pp_num6(t_str_mc6);
            gzlqrdDelBean.setMz_pp_num7(t_str_mc7);
            gzlqrdDelBean.setMz_pp_num8(t_str_mc8);

            //供气阀
            gzlqrdDelBean.setGqf_pp_num1(t_str_gqf1);
            gzlqrdDelBean.setGqf_pp_num2(t_str_gqf2);
            gzlqrdDelBean.setGqf_pp_num3(t_str_gqf3);
            gzlqrdDelBean.setGqf_pp_num4(t_str_gqf4);
            gzlqrdDelBean.setGqf_pp_num5(t_str_gqf5);
            gzlqrdDelBean.setGqf_pp_num6(t_str_gqf6);
            gzlqrdDelBean.setGqf_pp_num7(t_str_gqf7);
            gzlqrdDelBean.setGqf_pp_num8(t_str_gqf8);

            //报警器
            gzlqrdDelBean.setBjq_pp_num1(t_str_bjq1);
            gzlqrdDelBean.setBjq_pp_num2(t_str_bjq2);
            gzlqrdDelBean.setBjq_pp_num3(t_str_bjq3);
            gzlqrdDelBean.setBjq_pp_num4(t_str_bjq4);
            gzlqrdDelBean.setBjq_pp_num5(t_str_bjq5);
            gzlqrdDelBean.setBjq_pp_num6(t_str_bjq6);
            gzlqrdDelBean.setBjq_pp_num7(t_str_bjq7);
            gzlqrdDelBean.setBjq_pp_num8(t_str_bjq8);

            //压力表
            gzlqrdDelBean.setYlb_pp_num1(t_str_ylb1);
            gzlqrdDelBean.setYlb_pp_num2(t_str_ylb2);
            gzlqrdDelBean.setYlb_pp_num3(t_str_ylb3);
            gzlqrdDelBean.setYlb_pp_num4(t_str_ylb4);
            gzlqrdDelBean.setYlb_pp_num5(t_str_ylb5);
            gzlqrdDelBean.setYlb_pp_num6(t_str_ylb6);
            gzlqrdDelBean.setYlb_pp_num7(t_str_ylb7);
            gzlqrdDelBean.setYlb_pp_num8(t_str_ylb8);

            //背具总成
            gzlqrdDelBean.setBjzc_pp_num1(t_str_jyqOrBb1);
            gzlqrdDelBean.setBjzc_pp_num2(t_str_jyqOrBb2);
            gzlqrdDelBean.setBjzc_pp_num3(t_str_jyqOrBb3);
            gzlqrdDelBean.setBjzc_pp_num4(t_str_jyqOrBb4);
            gzlqrdDelBean.setBjzc_pp_num5(t_str_jyqOrBb5);
            gzlqrdDelBean.setBjzc_pp_num6(t_str_jyqOrBb6);
            gzlqrdDelBean.setBjzc_pp_num7(t_str_jyqOrBb7);
            gzlqrdDelBean.setBjzc_pp_num8(t_str_jyqOrBb8);

            //瓶阀
            gzlqrdDelBean.setPf_pp_num1(t_str_pf1);
            gzlqrdDelBean.setPf_pp_num2(t_str_pf2);
            gzlqrdDelBean.setPf_pp_num3(t_str_pf3);
            gzlqrdDelBean.setPf_pp_num4(t_str_pf4);
            gzlqrdDelBean.setPf_pp_num5(t_str_pf5);
            gzlqrdDelBean.setPf_pp_num6(t_str_pf6);
            gzlqrdDelBean.setPf_pp_num7(t_str_pf7);
            gzlqrdDelBean.setPf_pp_num8(t_str_pf8);

            //气瓶
            gzlqrdDelBean.setQp_pp_num1(t_str_qp1);
            gzlqrdDelBean.setQp_pp_num2(t_str_qp2);
            gzlqrdDelBean.setQp_pp_num3(t_str_qp3);
            gzlqrdDelBean.setQp_pp_num4(t_str_qp4);
            gzlqrdDelBean.setQp_pp_num5(t_str_qp5);
            gzlqrdDelBean.setQp_pp_num6(t_str_qp6);
            gzlqrdDelBean.setQp_pp_num7(t_str_qp7);
            gzlqrdDelBean.setQp_pp_num8(t_str_qp8);

            //箱子
            gzlqrdDelBean.setXz_pp_num1(t_str_xz1);
            gzlqrdDelBean.setXz_pp_num2(t_str_xz2);
            gzlqrdDelBean.setXz_pp_num3(t_str_xz3);
            gzlqrdDelBean.setXz_pp_num4(t_str_xz4);
            gzlqrdDelBean.setXz_pp_num5(t_str_xz5);
            gzlqrdDelBean.setXz_pp_num6(t_str_xz6);
            gzlqrdDelBean.setXz_pp_num7(t_str_xz7);
            gzlqrdDelBean.setXz_pp_num8(t_str_xz8);

            //总计
            gzlqrdDelBean.setZj_pp_num1(t_totle1);
            gzlqrdDelBean.setZj_pp_num2(t_totle2);
            gzlqrdDelBean.setZj_pp_num3(t_totle3);
            gzlqrdDelBean.setZj_pp_num4(t_totle4);
            gzlqrdDelBean.setZj_pp_num5(t_totle5);
            gzlqrdDelBean.setZj_pp_num6(t_totle6);
            gzlqrdDelBean.setZj_pp_num7(t_totle7);
            gzlqrdDelBean.setZj_pp_num8(t_totle8);



            ret.setCode(ResultMsg.SUCESS);
            ret.setMsg("查询成功");
            ret.setData(gzlqrdDelBean);

        }catch (Exception e) {
            ret.setCode(ResultMsg.ERROR);
            ret.setMsg("未知的错误，请稍候再试！");
            e.printStackTrace();
        }
        return ret;
    }
}
